home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / awatch1a / form1.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1998-10-09  |  7.7 KB  |  272 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "FireBall"
  6.    ClientHeight    =   4485
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   5850
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4485
  12.    ScaleWidth      =   5850
  13.    ShowInTaskbar   =   0   'False
  14.    StartUpPosition =   3  'Windows Default
  15.    WindowState     =   2  'Maximized
  16.    Begin VB.Label Label1 
  17.       BackStyle       =   0  'Transparent
  18.       Caption         =   "Click to Exit"
  19.       ForeColor       =   &H00FFFFFF&
  20.       Height          =   255
  21.       Left            =   120
  22.       TabIndex        =   0
  23.       Top             =   120
  24.       Width           =   5175
  25.    End
  26. Attribute VB_Name = "Form1"
  27. Attribute VB_GlobalNameSpace = False
  28. Attribute VB_Creatable = False
  29. Attribute VB_PredeclaredId = True
  30. Attribute VB_Exposed = False
  31. '***************************************************************************
  32. 'FireBall v1.0
  33. 'Author: Dustin Davis
  34. 'Bootleg Software Inc.
  35. 'http://www.warpnet.org/bsi
  36. 'This code is a VERY good, and EASY to follow program. If you properly
  37. 'read this code, you will learn very quickly how to do it yourself.
  38. 'also, you will learn how to draw and manipulate pixels. With that
  39. 'knowlage, you can make many awsome things, such as, demos, animations
  40. 'and so on. Please do not steal this code!
  41. '***************************************************************************
  42. 'Start the declarations
  43. 'Pixel location variables
  44. Dim X1 As Long
  45. Dim X2 As Long
  46. Dim X3 As Long
  47. Dim X4 As Long
  48. Dim X5 As Long
  49. Dim X6 As Long
  50. Dim X7 As Long
  51. Dim X8 As Long
  52. Dim Y1 As Long
  53. Dim Y2 As Long
  54. Dim Y3 As Long
  55. Dim Y4 As Long
  56. Dim Y5 As Long
  57. Dim Y6 As Long
  58. Dim Y7 As Long
  59. Dim Y8 As Long
  60. 'direction variable. 1&5=up, 2&6=down, 3&7=left, 4&8=right
  61. Dim Direction As Integer
  62. 'pixel tail locations. These are for erasing the tail!
  63. Dim Xx1(999) As Long
  64. Dim Yy1(999) As Long
  65. Dim Xx2(999) As Long
  66. Dim Yy2(999) As Long
  67. Dim Xx3(999) As Long
  68. Dim Yy3(999) As Long
  69. Dim Xx4(999) As Long
  70. Dim Yy4(999) As Long
  71. Dim Xx5(999) As Long
  72. Dim Yy5(999) As Long
  73. Dim Xx6(999) As Long
  74. Dim Yy6(999) As Long
  75. Dim Xx7(999) As Long
  76. Dim Yy7(999) As Long
  77. Dim Xx8(999) As Long
  78. Dim Yy8(999) As Long
  79. 'color variables
  80. Public tColor1 As Long 'this one will be set to red
  81. Public tColor2 As Long 'this one will be set to yellow
  82. Public bColor As Long 'this one will be set to black for the background
  83. Public iStop As Boolean 'stop variable
  84. Public Sub Start_Ants()
  85. 'this is the function that makes the magic happen!
  86. Dim i As Integer
  87. iStop = False
  88. 'set the begining pixels in the middle of the screen
  89. 'remeber, X1 and Y1 are the only ones that are important!
  90. X1 = Form1.Width / 2
  91. Y1 = Form1.Height / 2
  92. i = 0 'set the loop variable to 0
  93.     Randomize
  94.     DoEvents
  95.     Direction = (Rnd * 8) 'randomizing direction
  96.     Direction = ((Rnd * Direction) + (Rnd * Direction)) 'again so it doesnt favor one #
  97.     'check to see what direction its gonna go!
  98.     If Direction = 1 Or Direction = 5 Then 'go up
  99.         Y1 = Y1 - Direction 'Remember, X1 and Y1 are the most important.
  100.         'start offset of tail pixels
  101.         X2 = X1 + 2
  102.         Y2 = Y1 + 2
  103.         X3 = X1 + 4
  104.         Y3 = Y1 + 4
  105.         X4 = X1 + 6
  106.         Y4 = Y1 + 6
  107.         X5 = X1 + 8
  108.         Y5 = Y1 + 8
  109.         X6 = X1 + 10
  110.         Y6 = Y1 + 10
  111.         X7 = X1 + 12
  112.         Y7 = Y1 + 12
  113.         X8 = X1 + 14
  114.         Y8 = Y1 + 14
  115.         'put the pixels on the screen
  116.         PSet (X1, Y1), tColor1
  117.         PSet (X2, Y2), tColor2
  118.         PSet (X3, Y3), tColor1
  119.         PSet (X4, Y4), tColor2
  120.         PSet (X5, Y5), tColor1
  121.         PSet (X6, Y6), tColor2
  122.         PSet (X7, Y7), tColor1
  123.         PSet (X8, Y8), tColor2
  124.     ElseIf Direction = 2 Or Direction = 6 Then 'go down
  125.         Y1 = Y1 + Direction 'X1 and Y1 are the only ones you should change, offset the others
  126.         'start offset of tail pixels
  127.         X2 = X1 + 2
  128.         Y2 = Y1 + 2
  129.         X3 = X1 + 4
  130.         Y3 = Y1 + 4
  131.         X4 = X1 + 6
  132.         Y4 = Y1 + 6
  133.         X5 = X1 + 8
  134.         Y5 = Y1 + 8
  135.         X6 = X1 + 10
  136.         Y6 = Y1 + 10
  137.         X7 = X1 + 12
  138.         Y7 = Y1 + 12
  139.         X8 = X1 + 14
  140.         Y8 = Y1 + 14
  141.         'put pixels on the screen
  142.         PSet (X1, Y1), tColor1
  143.         PSet (X2, Y2), tColor2
  144.         PSet (X3, Y3), tColor1
  145.         PSet (X4, Y4), tColor2
  146.         PSet (X5, Y5), tColor1
  147.         PSet (X6, Y6), tColor2
  148.         PSet (X7, Y7), tColor1
  149.         PSet (X8, Y8), tColor2
  150.     ElseIf Direction = 3 Or Direction = 7 Then 'go left
  151.         X1 = X1 - Direction
  152.         'start offset of tail pixels
  153.         X2 = X1 + 2
  154.         Y2 = Y1 + 2
  155.         X3 = X1 + 4
  156.         Y3 = Y1 + 4
  157.         X4 = X1 + 6
  158.         Y4 = Y1 + 6
  159.         X5 = X1 + 8
  160.         Y5 = Y1 + 8
  161.         X6 = X1 + 10
  162.         Y6 = Y1 + 10
  163.         X7 = X1 + 12
  164.         Y7 = Y1 + 12
  165.         X8 = X1 + 14
  166.         Y8 = Y1 + 14
  167.         'show pixels
  168.         PSet (X1, Y1), tColor1
  169.         PSet (X2, Y2), tColor2
  170.         PSet (X3, Y3), tColor1
  171.         PSet (X4, Y4), tColor2
  172.         PSet (X5, Y5), tColor1
  173.         PSet (X6, Y6), tColor2
  174.         PSet (X7, Y7), tColor1
  175.         PSet (X8, Y8), tColor2
  176.     ElseIf Direction = 4 Or Direction = 8 Then 'go right
  177.         X1 = X1 + Direction
  178.         'start offset
  179.         X2 = X1 + 2
  180.         Y2 = Y1 + 2
  181.         X3 = X1 + 4
  182.         Y3 = Y1 + 4
  183.         X4 = X1 + 6
  184.         Y4 = Y1 + 6
  185.         X5 = X1 + 8
  186.         Y5 = Y1 + 8
  187.         X6 = X1 + 10
  188.         Y6 = Y1 + 10
  189.         X7 = X1 + 12
  190.         Y7 = Y1 + 12
  191.         X8 = X1 + 14
  192.         Y8 = Y1 + 14
  193.         'show pixels
  194.         PSet (X1, Y1), tColor1
  195.         PSet (X2, Y2), tColor2
  196.         PSet (X3, Y3), tColor1
  197.         PSet (X4, Y4), tColor2
  198.         PSet (X5, Y5), tColor1
  199.         PSet (X6, Y6), tColor2
  200.         PSet (X7, Y7), tColor1
  201.         PSet (X8, Y8), tColor2
  202.     End If
  203.     'start of tail editing
  204.     DoEvents
  205.     If i < 999 Then
  206.         i = i + 1
  207.     End If
  208.     'start of saving tail pixel locations for erasing later
  209.     Xx1(i) = X1
  210.     Yy1(i) = Y1
  211.     Xx2(i) = X2
  212.     Yy2(i) = Y2
  213.     Xx3(i) = X3
  214.     Yy3(i) = Y3
  215.     Xx4(i) = X4
  216.     Yy4(i) = Y4
  217.     Xx5(i) = X5
  218.     Yy5(i) = Y5
  219.     Xx6(i) = X6
  220.     Yy6(i) = Y6
  221.     Xx7(i) = X7
  222.     Yy7(i) = Y7
  223.     Xx8(i) = X8
  224.     Yy8(i) = Y8
  225.     If i >= 999 Then
  226.         i = 0
  227.         'this will erase the last part of the tail that are stored in memory
  228.         Do
  229.             i = i + 1
  230.             PSet (Xx1(i), Yy1(i)), bColor
  231.             PSet (Xx2(i), Yy2(i)), bColor
  232.             PSet (Xx3(i), Yy3(i)), bColor
  233.             PSet (Xx4(i), Yy4(i)), bColor
  234.             PSet (Xx5(i), Yy5(i)), bColor
  235.             PSet (Xx6(i), Yy6(i)), bColor
  236.             PSet (Xx7(i), Yy7(i)), bColor
  237.             PSet (Xx8(i), Yy8(i)), bColor
  238.         Loop Until i >= 999
  239.         i = 0
  240.     End If
  241.     'check to see if it has hit the walls or not, if so, then set location
  242.     'somewhere else
  243.     If Y1 >= Form1.Height - 100 Then
  244.         X1 = (Rnd * Form1.Width)
  245.         Y1 = (Rnd * Form1.Height)
  246.     ElseIf Y1 <= 10 Then
  247.         X1 = (Rnd * Form1.Width)
  248.         Y1 = (Rnd * Form1.Height)
  249.     ElseIf X1 <= 10 Then
  250.         X1 = (Rnd * Form1.Width)
  251.         Y1 = (Rnd * Form1.Height)
  252.     ElseIf X1 >= Form1.Width - 100 Then
  253.         X1 = (Rnd * Form1.Width)
  254.         Y1 = (Rnd * Form1.Height)
  255.     End If
  256.     'end wall check
  257. Loop Until iStop = True
  258. Unload Me
  259. End Sub
  260. Private Sub Form_Activate()
  261. Call Start_Ants
  262. End Sub
  263. Private Sub Form_Click()
  264. iStop = True
  265. End Sub
  266. Private Sub Form_Load()
  267. bColor = 0 'background color
  268. tColor1 = 65535 'yellow
  269. tColor2 = 33023 'red
  270. Form1.BackColor = bColor 'set form background color
  271. End Sub
  272.